import request from '@/utils/request'

interface IRoleResp {
  list: IRole[]
}

/**
 * 查询所有角色信息
 */
export const getAllRoles = () => request.get<any, IRoleResp>('/api/v1/admin/roles')

/**
 * 添加角色
 */
export const addRole = (data: IRole) => request.post('/api/v1/admin/roles', data)

/**
 * 修改角色
 */
export const updateRole = (data: IRole) => request.put('/api/v1/admin/roles/' + data.id, data)

/**
 * 删除角色
 */
export const deleteRole = (id: string) => request.delete('/api/v1/admin/roles/' + id)